The functions in this section obtain specific information about a synthesizer and obtain a best instrument fit for a requested tone from the available instruments within the synthesizer; play a note with a specified pitch, volume, and duration; get and set a particular synthesizer knob; obtain synthesizer knob information; and get and set external MIDI procedure name entry points.
The MusicGetDescription function returns a structure describing the synthesizer controlled by the music component device.
pascal ComponentResult MusicGetDescription(
MusicComponent mc,
SynthesizerDescription *sd);
The MusicFindTone function returns an instrument number based on a tone description.
pascal ComponentResult MusicFindTone(
MusicComponent mc,
ToneDescription *td,
long *libraryIndexOut,
unsigned long *fit);
The MusicFindTone function returns the number of the best-matching instrument provided by the specified music component. The closeness of the match is specified by the fit parameter.
The music component searches for an instrument as follows:
If none of these rules apply, or the fields are "blank" (zero for the type or numeric fields, or zero-length for the strings), then the call returns instrument 1 and a fit value of zero. The synthesizerName field may be ignored by the component; it is used by the note allocator when deciding which music device to use.
The MusicPlayNote function plays a note on a specified part at a specified pitch and velocity.
pascal ComponentResult MusicPlayNote(
MusicComponent mc,
long part,
long pitch,
long velocity);
The MusicPlayNote function is used to play notes by their pitch. If the pitch is specified by a number from 0 to 127, it is a MIDI pitch, where 60 is middle-C. If the pitch is a positive number above 65535, the value is a fixed-point pitch value. Thus, microtonal values may be specified.
Velocity refers to how hard the key is struck (if performed on a keyboard-instrument); typically, this translates directly to volume, but on many synthesizers this also subtly alters the timbre of the tone.
The current note continues to play until a MusicPlayNote with the same pitch and velocity of 0 turns the note off.
The MusicGetKnob function returns the value of the specified global synthesizer knob. A global knob controls an aspect of the entire synthesizer. It is not specific to a part within the synthesizer.
pascal ComponentResult MusicGetKnob(
MusicComponent mc,
long knobID);
The MusicSetKnob function modifies the value of the specified global synthesizer knob. A global knob controls an aspect of the entire synthesizer. It is not limited to a part within the synthesizer.
pascal ComponentResult MusicSetKnob(
MusicComponent mc,
long knobID,
long knobValue);
The MusicGetKnobDescription function returns a pointer to an initialized knob description structure describing a global synthesizer knob. A global knob controls an aspect of the entire synthesizer; it is not limited to a part within the synthesizer.
pascal ComponentResult MusicGetKnobDescription(
MusicComponent mc,
long knobIndex,
KnobDescription *mkd);
The MusicGetInstrumentKnobDescription function gets the description of an instrument knob.
extern pascal ComponentResult MusicGetInstrumentKnobDescription(
MusicComponent mc,
long knobIndex,
KnobDescription *mkd)
The MusicGetDrumKnobDescription function returns a description of a drum kit knob.
extern pascal ComponentResult MusicGetDrumKnobDescription(
MusicComponent mc,
long knobIndex,
KnobDescription *mkd)
The MusicGetKnobSettingStrings function returns a list of knob setting names known by the specified music component.
extern pascal ComponentResult MusicGetKnobSettingStrings(
MusicComponent mc,
long knobIndex,
long isGlobal,
Handle *settingsNames,
Handle *settingsCategoryLasts,
Handle *settingsCategoryNames)
The MusicSetMIDIProc function tells the music component what procedure to call when it needs to send MIDI data. This call is implemented only by a music component for a MIDI synthesizer.
pascal ComponentResult MusicSetMIDIProc(
MusicComponent mc,
MusicMIDISendUPP MIDISendProc,
long refCon);
The MusicGetMIDIProc function returns a pointer to the procedure a music component is using to process external MIDI notes.
pascal ComponentResult MusicGetMIDIProc(
MusicComponent mc,
MusicMIDISendUPP *MIDISendProc,
long *refCon);
The MusicGetMIDIProc function returns, in the *MIDISendProc parameter, a pointer to the function that processes external MIDI notes. This function was set by a previous call to the MusicSetMIDIProc function. If no function has been set with the MusicSetMIDIProc function, MusicGetMIDIProc returns zero in the *MIDISendProc parameter.
The MusicGetMIDIPorts function returns the number of input and output ports a MIDI device has.
extern pascal ComponentResult MusicGetMIDIPorts(
MusicComponent mc,
long *inputPortCount,
long *outputPortCount)
The function takes a music component identifier in the mc parameter and returns, in the inputPortCount and outputPortCount parameters, the number of MIDI input and output ports available to the music component.
This call is implemented only for a hardware synthesizer, such as a NuBus or PCI card device.
Use the MusicSendMIDI function to send a MIDI packet to a specified port.
extern pascal ComponentResult MusicSendMIDI(
MusicComponent mc,
long portIndex,
MusicMIDIPacket *mp)
The MusicSendMIDI function takes a music component in the mc parameter and a port index in the portIndex parameter. It sends the MIDI music packet specified by the *mp parameter to the specified port.
This call is implemented only for a hardware synthesizer, such as a NuBus or PCI card device.
You can use the MusicGetDeviceConnection function to find out how many hardware synthesizers are available to a music component and to get the IDs for those devices.
extern pascal ComponentResult MusicGetDeviceConnection(
MusicComponent mc,
long index,
long *id1,
long *id2)
To get the number of hardware synthesizers available to the music component specified in the mc parameter and an index you can use to request ID numbers for a specific device, call the MusicGetDeviceConnection function with a value of 0 for the index parameter. You can then pass an index value in the index parameter, and the function returns hardware synthesizer IDs in the *id1 and *id2 parameters.
This call is implemented only for a hardware synthesizer, such as a NuBus or PCI card device.
The MusicUseDeviceConnection function tells a music component which hardware synthesizer to talk to.
extern pascal ComponentResult MusicUseDeviceConnection(
MusicComponent mc,
long id1,
long id2)